package com.alangyun.remind.repository.algorithm;

/**
 * 学历程度
 *
 * @class com.alangyun.remind.repository.algorithm.Education
 * @company 北京诚朗信息技术有限公司
 * @author hoobort klxukun@126.com
 * @datetime 2022年11月23日 下午4:37:33
 *
 */
public enum Education implements IFactorEnum {
	BS("博士研究生", 3.0, 0.0, 0.0), 
	SSS("双硕士", 3.0, 0.0, 0.0), 
	SS("硕士研究生", 2.5, 0.0, 0.0), 
	SXS("双学士", 2, 0.0, 0.0),
	BK("大学本科", 1.5, 0.0, 0.0), 
	DZ("大学专科", 1, 0.0, 0.0),
	QT("其他(大专以下)", 0.5, 0.0, 0.0);

	private String keyCode;
	private double standVal;
	private double minVal;
	private double maxVal;

	private Education(String k, double standard, double min, double max) {
		this.keyCode = k;
		this.standVal = standard;
		this.minVal = min;
		this.maxVal = max;
	}

	public String key() {
		return keyCode;
	}

	public double standard() {
		return standVal;
	}

	public double min() {
		return minVal;
	}

	public double max() {
		return maxVal;
	}

	public static Education keyOf(String key) {
		Education ret = QT;
		if (key != null && key.length() > 0) {
			if (key.startsWith(BS.keyCode))
				ret = BS;
			else if (key.startsWith(SSS.keyCode))
				ret = SSS;
			else if (key.startsWith(SS.keyCode))
				ret = SS;
			else if (key.startsWith(SXS.keyCode))
				ret = SXS;
			else if (key.startsWith(BK.keyCode))
				ret = BK;
			else if (key.startsWith(DZ.keyCode))
				ret = DZ;
		}

		return ret;
	}
	
	public boolean than(Education compare) {
		return this.standVal >= compare.standVal;
	}
}
